export const state = {
	loadingShow: false, // 加载动画
	loginShow: false, // 登录
	token: '', // token
	user: {} // 用户数据
}

export const mutations = {
	setLoadingShow(state, data) {
		state.loadingShow = data
	},
	setLoginShow(state, data) {
		state.loginShow = data
	},
	setToken(state, data) {
		state.token = data
		uni.setStorageSync('token', data)
	},
	// 储存用户信息
	setUser(state, data) {
		if (data) {
			state.user = Object.assign({}, state.user, data)
			uni.setStorageSync('user', state.user)
		}
	},
	emptyUserInfo(state) {
		console.log('开始清空用户信息和令牌');
		state.user = {};
		state.token = '';
		uni.removeStorageSync("user");
		uni.removeStorageSync("token");
		console.log('用户信息和令牌已清空');
	}
}

export const actions = {}